<template>
<slot :controller="controller" :store="store" :model="model">
  
    <div :class="classNames" :id="controlID" style="min-height:200px;">
      <AppEmptyDataTip v-if="store.isNoData" ></AppEmptyDataTip>
      <div v-else class="control-content app-control-chart__content" :id="store.chartId"></div>
    </div>
</slot>
</template>
<script setup lang="ts">
// 基于template/src/widgets/{{appEntities}}/{{ctrls@CHART}}-chart/{{spinalCase ctrl.codeName}}-chart-base.vue.hbs生成
import { useProps, useBasic, useController } from './line-chart-hook';
import { ChartActionType, IChartAbility, IChartStore, IParam, IViewLogicInput } from "@/core/interface";


// 输入参数
const props = defineProps(useProps());

// 基础数据
const { controlID, getClassNames, model ,useNavParamsBind, useEventBind, handleActionClick, handleComponentAction } = useBasic(props);

const emit = defineEmits<{
    (event: 'ctrl-action', name: string, action: ChartActionType, data: IParam[]): void;
    (event: 'ctrl-init', name: string, data: IChartAbility): void;
    (event: 'ctrl-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
//  部件样式名
const classNames = computed(() => {
  return getClassNames(props);
});

//  图表控制器
const controller = useController(props, evt, { controlID });

useNavParamsBind(controller, props);

const store: IChartStore = controller.getStore();

onMounted(() => {
    controller.ctrlMounted();
});
onUnmounted(() => {
    controller.ctrlDestroy();
})
</script>